# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Ben <ben@benmazer.net>

pkgname=gmime3
pkgver=3.2.13
pkgrel=1
pkgdesc="A C/C++ MIME creation and parser library with support for S/MIME, PGP, and Unix mbox spools"
url="https://github.com/jstedfast/gmime"
arch=(x86_64)
license=(GPL)
depends=(glib2 gpgme zlib libidn2)
makedepends=(gobject-introspection gtk-doc git vala docbook-utils)
provides=(libgmime-3.0.so)
_commit=da1b041a2ce7e5e5c9d2c3e9499fe71b7a84d222  # tags/3.2.13^0
source=("git+https://github.com/jstedfast/gmime#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd gmime
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd gmime
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd gmime
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --enable-gtk-doc \
    --enable-smime \
    --disable-static
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd gmime
  make check
}

package() {
  cd gmime
  make DESTDIR="$pkgdir" install
}
